#include"processbar.h"
#include<string.h>
const char* lable="|/-\\";
char arr[NUM]; 


void processbar(int rate){

    int len=strlen(lable);
    if(rate<0||rate>100)return;
    printf("[%-100s][%d%%][%c]\r",arr,rate,lable[rate%len]);
    arr[rate++]=STYLE;
    if(rate<100)arr[rate]=RIGHT;
    fflush(stdout);

}

void initbar(){
    memset(arr,'\0',sizeof(arr));
}
